<?php
declare(strict_types=1);

namespace App\Resource\Group\Party;


use Illuminate\Http\Resources\Json\JsonResource;

class ReplyResource extends JsonResource
{
    public function toArray($request)
    {
        if(empty($this->id)){
            return null;
        }
        return [
            "id" => $this->id,
            "party_id" => $this->party_id,
            "user_id" => $this->user_id,
            "score" => $this->score,
            "cause" => $this->cause,
            "reject_cause" => $this->reject_cause,
            "status" => $this->status,
            "user" => UserResource::make($this->user),
            "gifts" => ReplyGiftResource::collection($this->gifts),
            "created_at" => $this->created_at->toDateTimeString(),
        ];
    }
}